<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2020/12/28
  Time: 10:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
    //获取项目名称
    String path = request.getContextPath();
    //获取: 协议://服务器名称:/端口号+ path +"/"
    //http://localhost:8080/StuAndTeacher/  --->main.jsp
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<html>
<head>
    <title>课程信息查看</title>
    <base href="<%=basePath%>">
    <link rel="stylesheet" href="layui/css/layui.css">
    <script src="layui/layui.js"></script>
</head>
<body>

<table id="demo" lay-filter="test"></table>
<script>
    layui.use('table',function () {
        var table = layui.table;

        //第一个实例
        tableResult = table.render({
            elem: '#demo' //获取table标签对象,准备填充数据
            ,url: 'findCourseAll' //获取数据的接口(servlet)
            ,page: true //开启分页
            ,size:"lg" //设置表格大小
            ,limit:3  //每页显示的条数是几条 (默认会向servlet发送 page(1)--第一页 和 limit(10)--显示10条 两个参数)
            ,limits:[1, 2, 3, 4, 5,6] //设置每页显示几条数据
            ,toolbar:true  //工具头,开启 删选,导出,打印的根据头(显示在表格的右边)
            ,cols: [[ //表头
                {title: '编号', fixed: 'left',align:"center",type:"numbers",width: 100}
                ,{field: 'courseName', title: '科目',align:"center"}
                ,{field: 'courseCredit', title: '学分',align:"center"}
                ,{field: 'courseHours', title: '学时' ,align:"center"}
                ,{field: 'courseTeacher', title: '任课老师',align:"center"}
                ,{field: 'courseDate', title: '开课时间',align:"center", width: 180 ,templet: "<div>{{layui.util.toDateString(d.courseDate, 'yyyy-MM-dd')}}</div>" }
            ]]
        });
    });
</script>
</body>
</html>
